<?php
namespace config;

class config {

    function __construct()
    {
        global $db;
        global $config;

        $config["dbName"]=$db->getDbName();

        $sSql = "select * from ".$config["dbName"].".`config`";
        $res = $db->execSql($sSql);

        while ($row = mysqli_fetch_assoc($res)) {
            $config[$row["nombre"]]= $row["valor"];
        }
    }

    public function addConfig($sName,$sValue){
        global $db;
        global $config;
        $rtrn = 0;

        $sSql = "insert into `".$config["dbName"]."`.`config` (`nombre`,`valor`) values('$sName','$sValue')";
        if ($db->execSql($sSql)){
            $rtrn = $db->getInsertedId();
        }

        return $rtrn;
    }




}